package cn.zero.flowspringbootstater.mapper;

import cn.zero.flowspringbootstater.modular.bean.UserConfiguration;
import cn.zero.flowspringbootstater.modular.entity.Flow;
import cn.zero.flowspringbootstater.modular.vo.FlowEventReVo;
import cn.zero.flowspringbootstater.modular.vo.FlowNode2UserVo;
import cn.zero.flowspringbootstater.modular.vo.FlowParamVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Set;

/**
 * <p>
 * 审批流程 Mapper 接口
 * </p>
 *
 * @author lei
 * @since 2022-06-17
 */
@Mapper
public interface FlowMapper extends BaseMapper<Flow> {

    /**
     * 查询业务上当前审批的状态
     */

    List<FlowEventReVo>  selectNodeDetail(@Param("flowId") String flowId, @Param("businessId") String businessId, @Param("userConfiguration") UserConfiguration userConfiguration);

    /**
     * 分页查询流程列表
     */

    List<Flow> selectLFlowList(@Param("flow") Flow flow, @Param("pageSize") Integer pageSize, @Param("pageNum") Integer pageNum);

    /**
     * 分页查询流程列表可用总数
     */

    int selectLFlowListPageCount(@Param("flow") Flow flow);
    /**
     * 查询流程下节点内容和审批人
     */

    List<FlowParamVo> selectFlowDetail(@Param("id") Long id, @Param("userConfiguration") UserConfiguration userConfiguration);

    /**
     * 根据业务id查询有权限操作的用户
     */

    List<FlowNode2UserVo> getHasRoleUserIdByBusinessId(@Param("businessId") Set<String> businessId);
}
